﻿using System.Data.Entity.ModelConfiguration;
using OneBlog.Model.Entities;

namespace OneBlog.DataAccessLayer.ModelConfigurations
{
    public class BlogCommentMap:EntityTypeConfiguration<BlogComment>
    {
        public BlogCommentMap()
        {
            ToTable("BlogComment");
            Property(c => c.Content).HasMaxLength(400);

            HasMany(c => c.ReplyComments).WithRequired(c => c.RootComment).HasForeignKey(c => c.RootCommentId);
        }
    }
}